﻿using System;
using System.Data;
using System.Data.SqlClient;
using AppEszköz.ErrorControl;

namespace AppEszköz.Log.Writers
{
    internal class SqlLogWriter : LogWriter
    {
        public override void Write(LogEntry log)
        {
        //    SqlConnection connection = new SqlConnection(LoggerSettings.SqlConnectionString);
        //    SqlParameterBuilder parameterBuilder = new SqlParameterBuilder();
        //    parameterBuilder.AddParameter("@eventid", SqlDbType.Int, (object)log.EventId);
        //    parameterBuilder.AddParameter("@message", SqlDbType.VarChar, (object)log.Message);
        //    parameterBuilder.AddParameter("@category", SqlDbType.VarChar, (object)log.Category);
        //    parameterBuilder.AddParameter("@priority", SqlDbType.Int, (object)log.Priority);
        //    parameterBuilder.AddParameter("@extendedinfo", SqlDbType.Text, (object)log.ExtendedInfo);
        //    try
        //    {
        //        SqlHelper.ExecuteNonQuery(connection, CommandType.StoredProcedure, "fm_WriteLog", parameterBuilder.ToArray());
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new GeneralException("LogWriter - Unable to execute SQL SP", ex);
        //    }
        //    finally
        //    {
        //        if (connection != null)
        //        {
        //            connection.Close();
        //            connection.Dispose();
        //        }
        //    }
        }
    }
}
